// gui
export default class GUI extends godot.Control {

    constructor() {
        super()

        // this.test_container()
        this.test_color_rect()
    }

    test_color_rect(){
        let hbox = new godot.HBoxContainer();
        hbox.margin_left = 10
        hbox.margin_top = 10
        hbox.rect_size = new godot.Vector2(500,600)

        hbox.add_child(this.create_color_rect(new godot.Color(1,1,1,1)))

        this.add_child(hbox)
    }
    test_container() {
        let hbox = new godot.HBoxContainer();

        hbox.size_flags_horizontal = 2;
        hbox.size_flags_vertical = 2;        


        let vbox1 = new godot.VBoxContainer();
        vbox1.size_flags_horizontal = 2;
        vbox1.size_flags_vertical = 2; 

        vbox1.add_child(this.create_label("ddd"))
        


        let vbox2 = new godot.VBoxContainer();
        vbox2.size_flags_horizontal = 2;
        vbox2.size_flags_vertical = 2; 

        // vbox2.add_child(this.create_label("cc"))
        vbox2.add_child(this.create_color_rect(new godot.Color(1,0,0,1)))


        hbox.add_child(vbox1)
        hbox.add_child(vbox2)

        this.add_child(hbox)
    }

    test_panel() {

    }


    create_color_rect(color:godot.Color){
        let rect = new godot.ColorRect();
        rect.color = color;
        rect.rect_size = new godot.Vector2(100,100)
        return rect
    }

    create_border_rect(color:godot.Color){
        let r = new godot.ReferenceRect();
        r.border_color = color
        r.editor_only = false
        r.rect_size = new godot.Vector2(100,100)
        
        return r;
    }

    create_label(text:string){
        let label = new godot.Label();
        label.text = text
        label.size_flags_horizontal = 2
        label.size_flags_vertical = 2
        return label
    }
}